home *** CD-ROM | disk | FTP | other *** search
File List | 1995-08-15 | 8.9 KB | 435 lines |
- ' *** ishido ***
- ' written by Martijn Dekker
- '
- ' I am thinking about writing a nicer version of this game, but only if
- ' you guys would like it. I am considering improving the graphics and
- ' making it into a 100% GEM driven program (placing the board in a window
- ' and making everything menu driven). I no longer program in GFA so the
- ' next version would be in C (my new passion). This is the main reason
- ' I uploaded this slightly primitive version, a better version will imply
- ' rewriting the whole beast in C, and I will only do that if some of you
- ' like the game and would enjoy a better version.
- '
- ' The idea of uploading this game came to me last week, when some friends
- ' were looking at some of the games I had written in the past. They discovered
- ' Ishido (which I wrote about a year ago) and played it all night.
- '
- ' If you like this game I would like to hear from you, for example send
- ' me a postcard (the program is shareware: I program for fun, not for $$).
- ' If you have ideas to improve the program, let me know. The adress is:
- '
- ' Martijn Dekker
- ' Prof. Jordanlaan 72
- ' 3571 KB UTRECHT
- ' the Netherlands
- '
- ' or send me an E-mail:
- ' internet: mdekker@fwi.uva.nl
- '
- Cls
- Gosub Intro
- Gosub Init
- Gosub Speel
- Gosub Einde
- Pause 500
- Procedure Intro
- Cls
- Deffill 1,2,1
- Prbox 200,130,390,210
- Deftext 1,4,0,128
- Text 240,180,"Ishido"
- Deftext 1,1,0,5
- Text 220,260,"by Martijn Dekker"
- Pause 75
- Return
- Procedure Init
- Vv=1
- Dim Code(6)
- Dim Pouch(72,2)
- Dim S(4)
- Dim M(4,2)
- Dim Speelveld(13,9,2)
- Score=0
- For I=0 To 13
- For J=0 To 9
- Speelveld(I,J,1)=0
- Speelveld(I,J,2)=0
- Next J
- Next I
- Code(1)=127
- Code(2)=157
- Code(3)=233
- Code(4)=232
- Code(5)=194
- Code(6)=223
- ' pouch vullen
- For I=1 To 6
- For J=1 To 6
- Pouch(6*I-6+J,1)=I
- Pouch(6*I-6+J,2)=J
- Next J
- Next I
- For I=1 To 36
- Pouch(I+36,1)=Pouch(I,1)
- Pouch(I+36,2)=Pouch(I,2)
- Next I
- ' nu husselen
- For I=1 To 50
- A=Int(72*Rnd(1)+1)
- B=Int(72*Rnd(1)+1)
- Swap Pouch(A,1),Pouch(B,1)
- Swap Pouch(A,2),Pouch(B,2)
- Next I
- Return
- Procedure Speel
- Cls
- Graphmode 1
- ' teken speelveld
- Deffill 1,2,1
- Pbox 60,80,460,320
- Box 17,37,503,363
- Box 510,37,632,363
- Deftext 1,16,0,13
- Text 260,30,"ishido"
- Deffill 1,2,8
- Fill 5,5
- Box 520,150,620,220
- Line 519,151,519,221
- Line 519,221,619,221
- Line 518,152,518,222
- Line 518,222,618,222
- Text 550,190,"Help!"
- Box 520,230,620,300
- Line 519,231,519,301
- Line 519,301,619,301
- Line 518,232,518,302
- Line 518,302,618,302
- Text 550,270,"quit!"
- For I=0 To 12
- Line 20+I*40,40,20+I*40,360
- Next I
- For I=0 To 8
- Line 20,40+40*I,500,40+40*I
- Next I
- Gosub Eersten
- Gosub Viertjes
- Geenzetmeer=False
- Pouchleeg=False
- Repeat
- Xc=540
- Yc=40
- Text 590,65,Nummer
- Gosub Laatzien
- Gosub Test
- If Not Geenzetmeer And Not Pouchleeg Then
- Repeat
- Mouse X,Y,K
- Until K=1
- Endif
- If X>=20 And X<=500 And Y>=40 And Y<=360 Then
- A=((X-20) Div 40)+1
- B=((Y-40) Div 40)+1
- Gosub Plaatsblok
- Endif
- If X>=520 And X<=620 And Y>=150 And Y<=220 Then
- Gosub Helpen
- Endif
- If X>=520 And X<=620 And Y>=230 And Y<=300 Then
- Alert 2,"Really quit ?",2,"yes|no!",To
- If To=1 Then
- End
- Else
- Cont
- Endif
- Endif
- Until Geenzetmeer Or Pouchleeg
- Return
- Procedure Einde
- If Pouchleeg Then
- Alert 2,"You did it!|another game ?",1,"yes|no",Toets
- Else
- Alert 2,"no possible move|too bad|another game ?",1,"yes|no",Toets
- Endif
- If Toets=1 Then
- Run
- Else
- End
- Endif
- Return
- Procedure Plaatsblok
- Gosub Kanhet
- If Hetkan=True Then
- Speelveld(A,B,1)=Pouch(Nummer,1)
- Speelveld(A,B,2)=Pouch(Nummer,2)
- Xc=20+(A-1)*40
- Yc=40+(B-1)*40
- Gosub Laatzien
- If Nummer=72 Then
- Score=Score+1000
- Pouchleeg=True
- Else
- Nummer=Nummer+1
- Endif
- Endif
- Return
- Procedure Laatzien
- Deffill 1,2,Pouch(Nummer,1)+1
- Pbox Xc,Yc,Xc+40,Yc+40
- Deftext 1,1,0,10
- Text Xc+13,Yc+25,Chr$(Code(Pouch(Nummer,2)))
- Text 511,357,"score "
- Text 580,357,Score
- Return
- Procedure Test
- Vv=0
- Vlag=0
- For A=1 To 12
- For B=1 To 8
- Gosub Kanhet
- If Hetkan Then
- Vlag=1
- Endif
- Next B
- Next A
- If Vlag=0 Then
- Geenzetmeer=True
- Endif
- Vv=1
- Return
- Procedure Kanhet
- If Speelveld(A,B,1)=0 Then
- Gosub Valid
- Else
- Hetkan=False
- Endif
- Return
- Procedure Valid
- For I=1 To 4
- M(I,1)=0
- M(I,2)=0
- Next I
- If Speelveld(A-1,B,1)=Pouch(Nummer,1) Then
- M(1,1)=1
- Else
- If Speelveld(A-1,B,1)<>0 Then
- M(1,1)=-1
- Endif
- Endif
- If Speelveld(A-1,B,2)=Pouch(Nummer,2) Then
- M(1,2)=1
- Else
- If Speelveld(A-1,B,2)<>0 Then
- M(1,2)=-1
- Endif
- Endif
- If Speelveld(A,B+1,1)=Pouch(Nummer,1) Then
- M(2,1)=1
- Else
- If Speelveld(A,B+1,1)<>0 Then
- M(2,1)=-1
- Endif
- Endif
- If Speelveld(A,B+1,2)=Pouch(Nummer,2) Then
- M(2,2)=1
- Else
- If Speelveld(A,B+1,2)<>0 Then
- M(2,2)=-1
- Endif
- Endif
- If Speelveld(A+1,B,1)=Pouch(Nummer,1) Then
- M(3,1)=1
- Else
- If Speelveld(A+1,B,1)<>0 Then
- M(3,1)=-1
- Endif
- Endif
- If Speelveld(A+1,B,2)=Pouch(Nummer,2) Then
- M(3,2)=1
- Else
- If Speelveld(A+1,B,2)<>0 Then
- M(3,2)=-1
- Endif
- Endif
- If Speelveld(A,B-1,1)=Pouch(Nummer,1) Then
- M(4,1)=1
- Else
- If Speelveld(A,B-1,1)<>0 Then
- M(4,1)=-1
- Endif
- Endif
- If Speelveld(A,B-1,2)=Pouch(Nummer,2) Then
- M(4,2)=1
- Else
- If Speelveld(A,B-1,2)<>0 Then
- M(4,2)=-1
- Endif
- Endif
- ' tel buren
- Buren=0
- Sum1=0
- Sum2=0
- For I=1 To 4
- S(I)=0
- Next I
- For I=1 To 4
- If M(I,1)<>0 Then
- Buren=Buren+1
- Endif
- Sum1=Sum1+M(I,1)
- Sum2=Sum2+M(I,2)
- S(I)=M(I,1)+M(I,2)
- Next I
- Hetkan=False
- If Buren=1 Then
- For I=1 To 4
- If M(I,1)=1 Or M(I,2)=1 Then
- Hetkan=True
- Endif
- Next I
- If Hetkan And A<>1 And B<>1 And A<>12 And B<>8 Then
- Score=Score+1*Vv
- Endif
- Endif
- If Buren=2 Then
- If (Sum1=2 And Sum2=2) Or (Sum1=2 And Sum2=0) Or (Sum2=2 And Sum1=0) Then
- Hetkan=True
- Endif
- If Sum1=0 And Sum2=0 Then
- Hetkan=True
- For I=1 To 4
- If S(I)=-2 Then
- Hetkan=False
- Endif
- Next I
- Endif
- If Hetkan And A<>1 And A<>12 And B<>1 And B<>8 Then
- Score=Score+2*Vv
- Endif
- Endif
- If Buren=3 Then
- If Sum1=1 Then
- I=1
- While M(I,1)<>-1
- I=I+1
- Wend
- If S(I)=0 Then
- Hetkan=True
- Endif
- Endif
- If Sum2=1 Then
- I=1
- While M(I,2)<>-1
- I=I+1
- Wend
- If S(I)=0 Then
- Hetkan=True
- Endif
- Endif
- If Sum1=3 And Sum2>=-1 Then
- Hetkan=True
- Endif
- If Sum2=3 And Sum1>=-1 Then
- Hetkan=True
- Endif
- If Hetkan And A<>1 And A<>12 And B<>1 And B<>8 Then
- Score=Score+4*Vv
- Endif
- Endif
- If Buren=4 Then
- If Sum1>=0 And Sum2>=0 Then
- Ae=0
- For I=1 To 4
- If M(I,1)=1 Or M(I,2)=1 Then
- Ae=Ae+1
- Endif
- Next I
- If Ae=4 Then
- Hetkan=True
- Av=Av+1*Vv
- Gosub Viertjes
- Endif
- Endif
- If Hetkan And A<>1 And A<>12 And B<>1 And B<>8 Then
- Score=Score+40*Vv
- Endif
- Endif
- Return
- Procedure Eersten
- Speelveld(1,1,1)=Pouch(1,1)
- Speelveld(1,1,2)=Pouch(1,2)
- Speelveld(12,1,1)=Pouch(2,1)
- Speelveld(12,1,2)=Pouch(2,2)
- Speelveld(12,8,1)=Pouch(3,1)
- Speelveld(12,8,2)=Pouch(3,2)
- Speelveld(1,8,1)=Pouch(4,1)
- Speelveld(1,8,2)=Pouch(4,2)
- Speelveld(6,4,1)=Pouch(5,1)
- Speelveld(6,4,2)=Pouch(5,2)
- Speelveld(7,5,1)=Pouch(6,1)
- Speelveld(7,5,2)=Pouch(6,2)
- Xc=20
- Yc=40
- Nummer=1
- Gosub Laatzien
- Xc=460
- Yc=40
- Nummer=2
- Gosub Laatzien
- Yc=320
- Nummer=3
- Gosub Laatzien
- Xc=20
- Nummer=4
- Gosub Laatzien
- Xc=220
- Yc=160
- Nummer=5
- Gosub Laatzien
- Xc=260
- Yc=200
- Nummer=6
- Gosub Laatzien
- Nummer=7
- Return
- Procedure Viertjes
- Box 555,100,565,130
- Box 545,110,575,120
- Text 590,120,Av
- Return
- Procedure Helpen
- Alert 2,"Are you sure you need help ?",2,"yes|no",To
- If To=1 Then
- Max=0
- Maxa=0
- Maxb=0
- Vv=0
- For A=1 To 12
- For B=1 To 8
- Gosub Kanhet
- If Hetkan Then
- If Buren>Max Then
- Max=Buren
- Maxa=A
- Maxb=B
- Endif
- Endif
- Next B
- Next A
- A=Maxa
- B=Maxb
- Deffill 1,2,8
- Pbox -20+40*A,40*B,20+40*A,40+40*B
- Pause 50
- Graphmode 3
- Pbox -20+40*A,40*B,20+40*A,40+40*B
- Graphmode 1
- If A<>1 And A<>12 And B<>1 And B<>8 Then
- Deffill 1,2,1
- Fill 40*A,40*B+20
- Endif
- A=12
- B=8
- Endif
- Vv=1
- Return
-